﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:props="clr-namespace:ScrumFactory.Windows.Properties;assembly=ScrumFactory.Windows"
                    xmlns:local="clr-namespace:ScrumFactory.Windows"
                    xmlns:SF_Helpers="clr-namespace:ScrumFactory.Windows.Helpers;assembly=ScrumFactory.Windows.Helpers"
                    xmlns:SF_Converters="clr-namespace:ScrumFactory.Windows.Helpers.Converters;assembly=ScrumFactory.Windows.Helpers">

    <SF_Converters:ToLowerConverter x:Key="ToLowerConverter" />

    

    
    <Style  TargetType="{x:Type SF_Helpers:PanelLayout}">
        <Setter Property="Background" Value="White"/>
        <Setter Property="BorderBrush" Value="#EAEAEA" />
        <Setter Property="Foreground" Value="{StaticResource TextBrush}"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type SF_Helpers:PanelLayout}">
                    <Grid Margin="0,0,0,0">                       
                        <Grid.RowDefinitions>                            
                            <RowDefinition Height="Auto" MinHeight="80" />
                            <RowDefinition Height="Auto" />                            
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>

                        <TextBlock 
                            Grid.Row="0" Grid.RowSpan="4" Text="{TemplateBinding Title, Converter={StaticResource ToLowerConverter}}" Style="{StaticResource PanelMainTitle}"                          
                            VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,-30,0,0" Padding="0"  />

                        <ContentPresenter Grid.Row="0" Content="{TemplateBinding Toolbar}" Margin="5,0,0,0" />
                        

                        <Border Grid.Row="1" Background="{TemplateBinding Background}">
                            <ContentPresenter Content="{TemplateBinding SubContent}" Margin="0"  />                            
                        </Border>


                        <Grid Grid.Row="2" Background="{TemplateBinding Background}" x:Name="windowTitle">

                            <StackPanel Orientation="Horizontal" Margin="22,8,0,8">

                                <TextBox FontWeight="SemiBold" Margin="0" Padding="0" Foreground="{StaticResource TitleTextBrush}" Style="{StaticResource CleanTextBox}" IsReadOnly="True">
                                    <TextBox.Text>
                                        <MultiBinding StringFormat="{}{0} - {1} [{2}]">
                                            <Binding Mode="OneWay" Path="Project.ClientName"/>
                                            <Binding Mode="OneWay" Path="Project.ProjectName"/>
                                            <Binding Mode="OneWay" Path="Project.ProjectNumber"/>
                                        </MultiBinding>
                                    </TextBox.Text>
                                </TextBox>

                                <Button 
                                        Style="{StaticResource OverButton}"                                                                         
                                        Command="{Binding DataContext.CopyProjectUrlCommand, RelativeSource={RelativeSource AncestorType={x:Type SF_Helpers:DockWindowContainer}}}"
                                        VerticalAlignment="Stretch" ToolTip="{x:Static props:Resources.Copy_project_url_to_clipboard}">
                                    <Image Source="/Images/Buttons/tag.png" Width="22" Height="22" Margin="5,0,5,0" VerticalAlignment="Center"/>
                                </Button>


                                <Button                                         
                                        Command="{Binding DataContext.ShowDocRepositoryCommand, RelativeSource={RelativeSource AncestorType={x:Type SF_Helpers:DockWindowContainer}}}"
                                        VerticalAlignment="Stretch" ToolTip="{Binding DataContext.Project.DocRepositoryPath, RelativeSource={RelativeSource AncestorType={x:Type SF_Helpers:DockWindowContainer}}}" Margin="0">
                                    <Image Source="/Images/Buttons/DocRep.png" Width="22" Height="22" Margin="5,0,5,0" VerticalAlignment="Center"/>
                                    <Button.Style>
                                        <Style BasedOn="{StaticResource OverButton}" TargetType="Button">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding DataContext.Project.DocRepositoryPath, RelativeSource={RelativeSource AncestorType={x:Type SF_Helpers:DockWindowContainer}}}" Value="{x:Null}">
                                                    <Setter Property="Visibility" Value="Collapsed"/>
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding DataContext.Project.DocRepositoryPath, RelativeSource={RelativeSource AncestorType={x:Type SF_Helpers:DockWindowContainer}}}" Value="">
                                                    <Setter Property="Visibility" Value="Collapsed"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Button.Style>
                                </Button>


                                <Button 
                                        Command="{Binding DataContext.ShowCodeRepositoryCommand, RelativeSource={RelativeSource AncestorType={x:Type SF_Helpers:DockWindowContainer}}}"                                        
                                        VerticalAlignment="Stretch" ToolTip="{Binding Project.CodeRepositoryPath}">
                                    <Image Source="/Images/Buttons/CodeRep.png" Width="24" Height="24" Margin="5,0,5,0" VerticalAlignment="Center"/>
                                    <Button.Style>
                                        <Style BasedOn="{StaticResource OverButton}" TargetType="Button">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding Project.CodeRepositoryPath}" Value="{x:Null}">
                                                    <Setter Property="Visibility" Value="Collapsed"/>
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding Project.CodeRepositoryPath}" Value="">
                                                    <Setter Property="Visibility" Value="Collapsed"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Button.Style>
                                </Button>


                            </StackPanel>


                            <local:SprintIndicator HorizontalAlignment="Right" Margin="0,0,5,0" />




                        </Grid>

                        

                        <Border Grid.Row="3" Background="{TemplateBinding Background}" >
                            <ContentPresenter Content="{TemplateBinding Content}" Margin="25,10,5,0"  />
                        </Border>


                        





                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="ShowCurrentProjectName" Value="False">
                            <Setter TargetName="windowTitle" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CoverPanelLayout" TargetType="{x:Type SF_Helpers:PanelLayout}" BasedOn="{StaticResource {x:Type SF_Helpers:PanelLayout}}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="ShowCurrentProjectName" Value="False"/>
        

    </Style>

    <Style x:Key="DetailPanelLayout" TargetType="{x:Type SF_Helpers:PanelLayout}" BasedOn="{StaticResource {x:Type SF_Helpers:PanelLayout}}">
        <Setter Property="ShowCurrentProjectName" Value="False"/>
    </Style>


</ResourceDictionary>